package struct;
public class Variable implements Identity {
    String nume;
    int index;
    
    public Variable(String nume, int index) {
        super();
        this.nume = nume;
        this.index = index;
    }
    
    public String getNume() {
        return nume;
    }
    
    public void setNume(String newNume)
    {
    	nume = newNume;
    }
    
    public int getIndex() {
        return index;
    }
    
    public void setIndex(int index) {
        this.index = index;
    }

    public int getMaxIndex() {
        return index;
    }
    
    public String toString()
    {
        if (index != 0)
        {
            return nume + index;
        }
        else
        {
            return nume;
        }
    }
    
    public boolean equals(Object var)
    {
        boolean ret = false;
        
        if (var != null && var instanceof Variable)
        {
            if (((Variable)var).getIndex() == index &&
                    ((Variable)var).getNume() == nume)
                return true;
        }
        
        return ret;
    }
    
    public Object clone()
    {
    	return new Variable(nume, index);
    }
}
